package com.shoppingmall.fragment;

import android.view.View;

import com.allen.library.SuperTextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.zyh.toolslib.base.BaseFragment;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.shoppingmall.R;
import com.shoppingmall.bean.ConsumeRecordBean;

import java.util.ArrayList;
import java.util.List;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;

/**
 * 2020/3/15
 * 描述：我的经销商明细里的重消币明细
 */
public class DealerConsumeCoinsDetailsFragment extends BaseFragment {
    @BindView(R.id.rv_content_list)
    RecyclerView rvContentList;
    @BindView(R.id.smart_refresh)
    SmartRefreshLayout smartRefresh;

    private List<ConsumeRecordBean> mData = new ArrayList<>();
    private BaseQuickAdapter<ConsumeRecordBean, BaseViewHolder> mAdapter;
    @Override
    protected void initView(View rootView) {
        smartRefresh.setEnableLoadMore(false);
        smartRefresh.setEnableRefresh(false);
    }

    @Override
    protected void initData() {
        for (int i = 0; i < 5; i++) {
            mData.add(new ConsumeRecordBean("消费", "11-01 15:33", "+50"));
        }
        mAdapter = new BaseQuickAdapter<ConsumeRecordBean, BaseViewHolder>(R.layout.item_mine_consume_record, mData) {
            @Override
            protected void convert(@NonNull BaseViewHolder helper, ConsumeRecordBean item) {
                SuperTextView superTextView = (SuperTextView) helper.itemView;
                superTextView.setLeftTopString(item.getTitle());
                superTextView.setLeftBottomString(item.getTime());
                superTextView.setRightString(item.getMoney());
            }
        };

        rvContentList.setLayoutManager(new LinearLayoutManager(mActivity));
        rvContentList.setAdapter(mAdapter);
    }

    @Override
    protected int initLayout() {
        return R.layout.fragment_recycleview;
    }
}
